<template>
	<el-drawer title="工作计划详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="计划标题" prop="title">
						{{form.title}}
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="排序号" prop="sortNo">
								{{form.sortNo}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="计划类型" prop="planType">
								{{form.planTypeName}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="开始时间" prop="beginTime">
								{{form.beginTime}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="结束时间" prop="endTime">
								{{form.endTime}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="计划负责人" prop="holdUser">
								{{form.holdUserName}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="督办领导" prop="supUser">
								{{form.supUserName}}
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="计划详情">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="计划附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="form.attachRole" :preview="true"></attach-menu>
					</el-form-item>
					<div v-if="processList.length>0">
						<el-divider>处理结果</el-divider>
						<el-form-item label="处理意见" v-for="item in processList" :key="item.processId">
							{{item.remark}}
							<div style="width: 100%;">
								<attach-menu :attachIds="item.attachId" :roleFlag="3" :preview="true"></attach-menu>
							</div>
						</el-form-item>
					</div>

				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			processList:[],
			form: {
				sortNo:"",
				title:"",
				planTypeName:"",
				beginTime:"",
				endTime:"",
				holdUserName:"",
				supUserName:"",
				content:"",
				attachRole:"",
				attachId:"",
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(){
			this.visible = true;
			return this;
		},
		async getWorkPlanProcessList(){
			var res = await this.$API.office.workPlan.getWorkPlanProcessList.get({planId: this.form.planId});
			if (res.code == 200) {
				this.processList = res.data;
			}
		},
		//表单注入数据
		setData(data){
			this.form.sortNo = data.sortNo
			this.form.title = data.title
			this.form.planTypeName = data.planTypeName
			this.form.beginTime = data.beginTime
			this.form.endTime = data.endTime
			this.form.holdUserName = data.holdUserName
			this.form.supUserName = data.supUserName
			this.form.content = data.content
			this.form.attachRole = data.attachRole
			this.form.attachId = data.attachId
			this.getWorkPlanProcessList();
		},
		async getMyWorkPlanById(data)
		{
			let res = await this.$API.office.workPlan.getMyWorkPlanById.get({planId:data});
			{
				if(res.code==200)
				{
					this.form.sortNo = res.data.sortNo
					this.form.title = res.data.title
					this.form.planTypeName = res.data.planTypeName
					this.form.beginTime = res.data.beginTime
					this.form.endTime = res.data.endTime
					this.form.holdUserName = res.data.holdUserName
					this.form.supUserName = res.data.supUserName
					this.form.content = res.data.content
					this.form.attachRole = res.data.attachRole
					this.form.attachId = res.data.attachId
					this.getWorkPlanProcessList();
				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}
}
</script>

<style>
</style>
